<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
	prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"
	prefix="bean"%>
<html>
<head>
<title>A Free Online Rental Application</title>
<script LANGUAGE="JavaScript">
	function validateNewUserForm() {
		if (document.newUserForm.userFullName.value == "") {
			alert("Full Name should n't be left blank");
			document.newUserForm.userFullName.focus();
			return false;
		} else if (document.newUserForm.userName.value == "") {
			alert("Login User Name should n't be left blank");
			document.newUserForm.userName.focus();
			return false;
		} else if (document.newUserForm.password.value == "") {
			alert("Password should n't be left blank");
			document.newUserForm.password.focus();
			return false;
		} else if (document.newUserForm.confPassword.value == "") {
			alert("Conform Password should n't be left blank");
			document.newUserForm.confPassword.focus();
			return false;
		} else if (document.newUserForm.confPassword.value != document.newUserForm.password.value) {
			alert("Conform Password should be same as password");
			document.newUserForm.confPassword.focus();
			return false;
		} else if (document.newUserForm.email.value == "") {
			alert("Email should n't be left blank");
			document.newUserForm.email.focus();
			return false;
		} else if (document.newUserForm.mobile.value == "") {
			alert("Mobile - should n't be left blank");
			document.newUserForm.mobile.focus();
			return false;
		} else if (document.newUserForm.profession.value == "") {
			alert("profession should n't be left blank");
			document.newUserForm.profession.focus();
			return false;
		} else if (document.newUserForm.userType.value == "") {
			alert("User Type should n't be left blank");
			document.newUserForm.userType.focus();
			return false;
		} else if (document.newUserForm.houseNo.value == "") {
			alert("House No should n't be left blank");
			document.newUserForm.houseNo.focus();
			return false;
		} else if (document.newUserForm.street.value == "") {
			alert("Street should n't be left blank");
			document.newUserForm.street.focus();
			return false;
		} else if (document.newUserForm.state.value == "") {
			alert("state should n't be left blank");
			document.newUserForm.state.focus();
			return false;
		} else if (document.newUserForm.city.value == "") {
			alert("City should n't be left blank");
			document.newUserForm.city.focus();
			return false;
		} else if (document.newUserForm.zipCode.value == "") {
			alert("Zip Code should n't be left blank");
			document.newUserForm.zipCode.focus();
			return false;
		} else {
			document.newUserForm.action = "newUser?dispatch=addUser";
			document.newUserForm.submit();
		}
	}
	
	function getStateCities() {
		var stateId = document.getElementById('state').value;
		document.newUserForm.action = "newUser?stateId=" + stateId;
		document.newUserForm.submit();
	}
</script>
</head>
<body>
<table width="100%">
	<tr>
		<td align="center">
		<h4><bean:message key="rental.m1" /></h4>
		</td>
	</tr>
	<tr>
		<td align="center">
		<h4><bean:message key="rental.m4" /></h4>
		</td>
	</tr>
</table>

</body>
<CENTER><html:errors />
<table>
	<html:form action="newUser">
		<tr>
			<td><bean:message key="userRegistration.userFullName" /> *</td>
			<td><html:text name="registeredForm" property="userFullName" /></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.userName" /> *</td>
			<td><html:text name="registeredForm" property="userName" /></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.password" /> *</td>
			<td><html:password name="registeredForm" property="password" /></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.confPassword" /> *</td>
			<td><html:password name="registeredForm" property="confPassword" /></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.email" /> *</td>
			<td><html:text name="registeredForm" property="email" /></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.mobile" /> *</td>
			<td><html:text name="registeredForm" property="mobile" /></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.profession" /> *</td>
			<td><html:text name="registeredForm" property="profession" /></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.gender" /> *</td>
			<td><html:radio name="registeredForm" property="gender" value="true">
				<bean:message key="userRegistration.male" />
			</html:radio> <html:radio name="registeredForm" property="gender" value="false">
				<bean:message key="userRegistration.female" />
			</html:radio></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.userType" /> *</td>
			<td><html:text name="registeredForm"  property="userType" /></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.houseNo" /> *</td>
			<td><html:text name="registeredForm" property="houseNo" /></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.street" /> *</td>
			<td><html:text name="registeredForm" property="street" /></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.state" /> *</td>
			<td><html:select name="registeredForm" property="state" onchange="getStateCities()">
				<html:optionsCollection name="states" label="stateName"
					value="statId" />
			</html:select></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.city" /> *</td>
			<td><html:select name="registeredForm" property="city">
				<html:optionsCollection name="stateCities" label="cityName"
					value="cityId" />
			</html:select></td>
		</tr>
		<tr>
			<td><bean:message key="userRegistration.zipCode" /> *</td>
			<td><html:text name="registeredForm" property="zipCode" /></td>
		</tr>
		<tr>
			<td></td>
			<td><input type="button" value="Submit Your Details >> "
				onclick="validateNewUserForm()" /></td>
		</tr>
	</html:form>
</table>
</CENTER>
</html>
